<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta
	content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
	name="viewport">
<title>whit-大数据博客 | 个人中心</title>
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/font-awesome/css/font-awesome.min.css">

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionicons/css/ionicons.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/iCheck/square/blue.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/morris/morris.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/datepicker/datepicker3.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/daterangepicker/daterangepicker.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/datatables/dataTables.bootstrap.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/treeTable/jquery.treetable.theme.default.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/select2/select2.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/colorpicker/bootstrap-colorpicker.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/adminLTE/css/skins/_all-skins.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/css/style.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/ionslider/ion.rangeSlider.skinNice.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-slider/slider.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">

<link rel="stylesheet"
	href="${pageContext.request.contextPath}/plugins/toastr/toastr.min.css">


<!-- Custom styles for this template -->
<link href="${pageContext.request.contextPath}/css/blog.css"
	rel="stylesheet">

<style type="text/css">
.blog-post img {
	max-width: 600px;
}
</style>


</head>
<body>
	<%@ include file="/view/main/header.jsp"%>

	<div class="container">
		<div class="row">
			<div class="col-sm-8 blog-main">
				<h3 class="blog-title">我的博客</h3>
				<p class="lead blog-description">The official example template
					of creating a blog with Bootstrap.</p>

				<c:forEach items="${page.list}" var="p" varStatus="status">
					<div class="blog-post">
						<h2 class="blog-post-title">
							<a target="_blank"
								href="${pageContext.request.contextPath}/TblogServlet?method=show&id=${p.id}">${ p.title }</a>
						</h2>
						<p class="blog-post-meta">
							${ p.publishTime } by <a href="#">${ p.username }</a>
						</p>

						<p>${ p.content }</p>
						<ul class="nav navbar-nav">
							<button onclick="delAction(this,${p.id})" style="margin: 2px"
								type="button" class="btn btn-default">
								<span class="fa fa-fw fa-close"></span> 删除  
							</button>
							<button style="margin: 2px" type="submit" class="btn btn-default">
								<span class="fa fa-fw fa-edit"></span> 修改  
							</button>
						 
						</ul>
					</div>
					<div style="display: none">
					</div>
					<hr>

					<!-- /.blog-post -->
				</c:forEach>

				<div class="box-footer">
					<div class="pull-left">
						<div class="form-group form-inline">总共${page.totalPageNum}
							页，共${page.totalRecords } 条数据。第${page.currentPageNum}页</div>
					</div>

					<div class="box-tools pull-left">
						<ul class="pagination">
							<li><a
								href="${pageContext.request.contextPath}/${page.url}&num=1&titleSelected=${title}&tblogtypeid=${tblogtypeid}"
								aria-label="Previous">首页</a></li>
							<li><a
								href="${pageContext.request.contextPath}/${page.url}&num=${page.prePageNum}&titleSelected=${title}&tblogtypeid=${tblogtypeid}">上一页</a></li>

							<c:forEach begin="${page.startPage}" end="${page.endPage}"
								var="pagenum">
								<li><a
									style="color: ${page.currentPageNum==pagenum?'#337ab7':'' }"
									href="${pageContext.request.contextPath}/${page.url}&num=${pagenum}&titleSelected=${title}&tblogtypeid=${tblogtypeid}">${pagenum}</a></li>
							</c:forEach>

							<li><a
								href="${pageContext.request.contextPath}/${page.url}&num=${page.nextPageNum}&titleSelected=${title}&tblogtypeid=${tblogtypeid}">下一页</a></li>
							<li><a
								href="${pageContext.request.contextPath}/${page.url}&num=${page.totalPageNum}&titleSelected=${title}&tblogtypeid=${tblogtypeid}"
								aria-label="Next">尾页</a></li>
						</ul>
					</div>
				</div>

			</div>
			<!-- /.blog-main -->

			<div class="col-sm-3 col-sm-offset-1 blog-sidebar">
				<div class="sidebar-module" style="text-align: center;">
					<img style="width: 60px;"
						class="img-responsive img-circle img-thumbnail" alt=""
						src="${pageContext.request.contextPath}/images/tiger.jpg">
					<ul class="list-unstyled list-inline" style="margin: 2px;">
						<li>${loginUser}</li>
					</ul>
					<ul class="list-unstyled list-inline">
						<li><strong>文章数 (12)</strong></li>
						<li><strong>点赞数 (12)</strong></li>
						<li><strong>收藏数 (12)</strong></li>
						<li><strong>评论数 (12)</strong></li>
					</ul>
				</div>
				<div class="sidebar-module" style="text-align: center;">
					<button class="btn btn-primary btn-lg"
						onclick="javascript:self.location='${pageContext.request.contextPath}/TblogServlet?method=newBlog'">写博客</button>
				</div>
				<div class="sidebar-module sidebar-module-inset">
					<h4>About</h4>
					<p>
						Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras
						mattis consectetur purus sit amet fermentum. Aenean lacinia
						bibendum nulla sed consectetur.
					</p>
				</div>
				<div class="sidebar-module">
					<h4>分类 </h4>
					<ol class="list-unstyled">
						<li><a style="color: ${tblogtypeid eq 'all'?'#E9CFAE':'' }" href="${pageContext.request.contextPath}/TblogServlet?method=personal&tblogtypeid=all" class="active">全部</a></li>
						<c:forEach items="${list}" var="p" varStatus="status">
							<li style="margin-top: 5px"><a style="color: ${tblogtypeid==p.id?'#E9CFAE':'' }" href="${pageContext.request.contextPath}/TblogServlet?method=personal&tblogtypeid=${p.id}">${p.title}</a></li>
						</c:forEach>
					</ol>
				</div>
				<div class="sidebar-module">
					<h4>其它</h4>
					<ol class="list-unstyled">
						<li><a href="#">GitHub</a></li>
						<li><a href="#">Twitter</a></li>
						<li><a href="#">Facebook</a></li>
					</ol>
				</div>
			</div>
			<!-- /.blog-sidebar -->

		</div>
		<!-- /.row -->

	</div>
	<!-- /.container -->

	<%@ include file="/view/main/foot.jsp"%>

</body>

<script
	src="${pageContext.request.contextPath}/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script
	src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>

<script
	src="${pageContext.request.contextPath}/plugins/toastr/toastr.min.js"></script>


<script type="text/javascript">
	window.scrollTo(0,0); 

	toastr.options.positionClass = 'toast-bottom-center';
	
	//删除博客
	function delAction(event,id){

		if(confirm("是否确认删除？")){
			$.ajax({
	            type : "POST",
	            contentType: "application/json;charset=UTF-8",
	            url : "TblogServlet?method=deleteByWriter&blogid=" + id,
	            success : function(result) {
	                console.log(result);
					toastr.success('删除成功','',{timeOut: 1000});
					//页面刷新
					location.reload();
	            },
	            error : function(e){
	                console.log(e.status);
	                console.log(e.responseText);
	                toastr.success('删除失败','',{timeOut: 1000});
	            }
	        });
		}
        
	} 

	 
</script>



</html>